# Create your models here.
from django.contrib.auth.models import AbstractUser
from django.db import models


class User(AbstractUser):
    name = models.CharField(max_length=50, unique=False, verbose_name="姓名", null=True)
    telephone = models.CharField(max_length=11, unique=True, verbose_name='手机号', null=True)
    birthday = models.DateField(default=None, verbose_name="生日", null=True)
    avatar = models.ImageField(upload_to="images", verbose_name="图片")
    text = models.CharField(max_length=200, default=None, verbose_name="个性签名", null=True)
    sex = models.CharField(max_length=2, default="男", verbose_name="性别", null=True)
    REQUIRED_FIELDS = ['name', 'telephone', 'birthday', 'email', 'text', 'sex']

    class Meta:
        db_table = "users"
        verbose_name = '用户管理'
        verbose_name_plural = verbose_name
        ordering = ('id',)

    def __str__(self):
        return self.username
